#pragma once
#include "DeviceBase.h"

namespace RobotPlant { namespace RobotProxy{
	using namespace std;
	using namespace boost::join;
	using namespace RobotPlant::Common;

	/*
	The Battery Device provides information on the state of the battery and notifications when the battery level falls below a critical level.
	*/
	class RP_ROBOTPROXY_API BatteryDevice : public DeviceBase
	{
	public:
		/*
		Constructor
		*/
		BatteryDevice(RobotInstance* pParent,joint::spawn_type e=0);

		~BatteryDevice();

		/*
		Gets or sets the maximum value when the battery is fully charged (default value is 1).
		*/
		synch<double,void> GetMaxBatteryPower;

		/*
		Gets percentage of battery power remaining.
		*/
		synch<double,void> GetPercentBatteryPower;

		/*
		Gets percentage of battery power at which operation may be impaired.
		*/
		synch<double,void> GetPercentCriticalBattery;

		/*
		Sets percentage of battery power at which operation may be impaired.
		*/
		async<double> SetPercentCriticalBattery;

	protected:
		double Handler_GetMaxBatteryPower(void_t);

		double Handler_GetPercentBatteryPower(void_t);

		double Handler_GetPercentCriticalBattery(void_t);

		void Handler_SetPercentCriticalBattery(double criticalBattery);
	};
}}
